package common

import (
	//"git.edaijia-inc.cn/edaijia/ego/enaming"
	//"git.edaijia-inc.cn/edaijia/ego/eredis"
	//"git.edaijia-inc.cn/edaijia/ego/emysql"
	//"git.edaijia-inc.cn/edaijia/ego/etracer"
	"git.edaijia-inc.cn/edaijia/ego/elogger"

	_ "EREST/docs"

	"github.com/gin-gonic/gin"
	"github.com/swaggo/files"       // swagger embed files
	"github.com/swaggo/gin-swagger" // gin-swagger middleware
)

//var FooRedis *eredis.ERedis
//var BarMysql *emysql.EMysql

func Init(config *GlobalConfig, r *gin.Engine) {
	elogger.Debug("common init")

	//redis
	//FooRedis = eredis.InitERedis(config.Redis)

	//redis
	//BarMysql = emysql.InitEMysql(config.Mysql)

	//register nacos
	//enaming.Register(config.Naming, config.Service, config.HttpAddr)
	if config.Env != "dev" {
		//register nacos
		//enaming.Register(conf.Naming, conf.Service, conf.HttpAddr)

		//init skywalking
		//etracer.InitETracer(conf.Tracer, conf.Service)
		//etracer.InitGinMiddleware(r)
	}

	//swagger
	if config.Env != "prod" {
		url := ginSwagger.URL("/swagger/doc.json")
		r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
	}

}
